package com.reshare.service;

import com.reshare.mapper.StatisticsMapper;
import com.reshare.model.CommodityCountModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/*功能描述
 * @author ahm
 */
@Service
public class StatisticsService {

    @Resource
    private StatisticsMapper statisticsMapper;

    /*<!--    //    商品状态（1，出售中；2，售罄；3，下架；4，该商品已删除，保留文本内容）
    //
    Integer salingCount ;
    Integer outOfStock;
    Integer underCarriage;

    // 求购条数 今日求购  总求购条数
    Integer allSeekCount;
    Integer todaySeek;
-->
    */


    public CommodityCountModel toStatistic(){

        CommodityCountModel commodityCountModel = new CommodityCountModel();
        Integer todayCommodity = statisticsMapper.selectTodayCommodity();
        Integer salingCount = statisticsMapper.selectAllSeekCount();
        Integer outOfStock = statisticsMapper.selectOutOfStock();
        Integer underCarraiage = statisticsMapper.selectUnderCarraiage();

        Integer allSeekCount = statisticsMapper.selectAllSeekCount();
        Integer todaySeek = statisticsMapper.selectTodaySeek();

        commodityCountModel.setTodayCommodity(todayCommodity);
        commodityCountModel.setSalingCount(salingCount);
        commodityCountModel.setOutOfStock(outOfStock);
        commodityCountModel.setUnderCarriage(underCarraiage);
        commodityCountModel.setAllSeekCount(allSeekCount);
        commodityCountModel.setTodaySeek(todaySeek);
        return commodityCountModel;
    }


}
